package com.example.rjxmgl.controller;

import com.example.rjxmgl.entity.dos.Leave;
import com.example.rjxmgl.service.LeaveService;
import com.example.rjxmgl.utils.ResultMessage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.Arrays;




/**
 * 请假表
 *
 * @author khai 951992121@qq.com
 * @since 1.0.0 2024-12-05
 */
@RestController
@RequestMapping("staff/leave")
@Api(tags = "请假表")
public class LeaveController {

    @Autowired
    private LeaveService leaveService;

    @PostMapping("/studentAskForLeave")
    @Operation(summary = "学生提交请假申请")
    public ResultMessage studentAskForLeave(@RequestBody Leave leave){
        return leaveService.studentAskForLeave(leave);
    }

    @GetMapping("/headTeacherGetList/{headTeacherId}")
    @Operation(summary = "班主任查看请假列表")
    public ResultMessage headTeacherGetList(@PathVariable("headTeacherId")Long headTeacherId){
        return leaveService.headTeacherGetList(headTeacherId);
    }

    @PostMapping("/headTeacherCheck/{leaveId}/{result}")
    @Operation(summary = "班主任审核请假，同意result为true，不同意result为false")
    public ResultMessage headTeacherCheck(@PathVariable("leaveId")Long leaveId,
                                          @PathVariable("result")boolean result){
        return leaveService.headTeacherCheck(leaveId,result);
    }

    @GetMapping("/CounselorGetList/{counselorId}")
    @Operation(summary = "辅导员查看请假列表")
    public ResultMessage CounselorGetList(@PathVariable("counselorId")Long counselorId){
        return leaveService.CounselorGetList(counselorId);
    }

    @PostMapping("/counselor/{leaveId}/{result}")
    @Operation(summary = "班主任审核请假，同意result为true，不同意result为false")
    public ResultMessage CounselorCheck(@PathVariable("leaveId")Long leaveId,
                                          @PathVariable("result")boolean result){
        return leaveService.counselorCheck(leaveId,result);
    }

    @GetMapping("/studentGetList/{studentId}")
    @Operation(summary = "学生查看请假列表")
    public ResultMessage studentGetList(@PathVariable("studentId")Long studentId){
        return leaveService.studentGetList(studentId);
    }


}